import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';

export const columns: BasicColumn[] = [
  {
    title: '登记日期',
    dataIndex: 'createTime',
    width: 150,
  },
  {
    title: '提交人',
    dataIndex: 'optUserName',
    width: 120,
  },
  {
    title: '预约人',
    dataIndex: 'appointmentName',
    width: 100,
  },
  {
    title: '使用人',
    dataIndex: 'userName',
    width: 100,
  },
  {
    title: '联系电话',
    dataIndex: 'appointmentPhone',
    width: 120,
  },
  {
    title: '预约日期',
    dataIndex: 'appointmentDate',
    width: 100,
  },
  {
    title: '起飞时间',
    dataIndex: 'takeOffTime',
    width: 100,
  },
  {
    title: '航班号',
    dataIndex: 'flightNumber',
    width: 100,
  },
  {
    title: '始发地',
    dataIndex: 'originatingPlace',
    width: 100,
  },
  {
    title: '到达地',
    dataIndex: 'destinationPlace',
    width: 100,
  },
  {
    title: '会员卡号',
    dataIndex: 'vipCardNo',
    width: 150,
  },
  {
    title: '使用次数',
    dataIndex: 'numValue',
    width: 100,
  },
  {
    title: '服务类型',
    dataIndex: 'serverType',
    width: 100,
    customRender: ({ record }: Recordable) => {
      const serverTypes = [
        { label: '接机', value: '1' },
        { label: '送机', value: '2' },
      ];
      const serverType: any = serverTypes.find((item) => item.value == record.serverType);
      if (serverType) {
        return serverType.label;
      }
      return '';
    },
  },
  {
    title: '预约状态',
    dataIndex: 'appointmentState',
    width: 100,
    customRender: ({ record }: Recordable) => {
      const appointmentStates = [
        { label: '待处理', value: 0 },
        { label: '预约成功', value: 1 },
        { label: '预约失败', value: 2 },
      ];
      const appointmentState: any = appointmentStates.find((item) => item.value == record.appointmentState);
      if (appointmentState) {
        return appointmentState.label;
      }
      return '';
    },
  },
  {
    title: '处理日期',
    dataIndex: 'optDate',
    width: 100,
  },
  {
    title: '企业名称',
    dataIndex: 'enterpriseName',
    width: 100,
  },
  {
    title: '车牌号',
    dataIndex: 'plateNumber',
    width: 100,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 300,
    align: 'left',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'appointmentName',
    label: '预约人',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'serverType',
    label: '服务类型',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        { label: '接机', value: 1 },
        { label: '送机', value: 2 },
      ],
    },
  },
  {
    field: 'appointmentState',
    label: '预约状态',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        { label: '待处理', value: 0 },
        { label: '预约成功', value: 1 },
        { label: '预约失败', value: 2 },
      ],
    },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
];

export const guestRecordCheckSchema: FormSchema[] = [
  {
    label: '接机送机主键',
    field: 'guestrecordId',
    component: 'Input',
    required: true,
    show: false,
  },
  {
    label: '预约状态',
    field: 'appointmentState',
    component: 'RadioGroup',
    required: true,
    defaultValue: 3,
    componentProps: {
      options: [
        { label: '预约成功', value: 1 },
        { label: '预约失败', value: 2 },
      ],
    },
  },
  {
    label: '提醒方式',
    field: 'noticeWay',
    component: 'RadioGroup',
    required: true,
    defaultValue: 3,
    componentProps: {
      options: [
        { label: '短信', value: 1 },
        { label: '系统消息', value: 2 },
        { label: '全部', value: 3 },
      ],
    },
  },
  {
    label: '车牌号',
    field: 'plateNumber',
    component: 'Input',
    required: false,
  },
];
